import request from '@u/request'

// 首页轮播接口
const fetchHomeBanner = (params = {}) => {
  return request.get('/banner/list', {params})
}
// 请求分类列表
const fetchCates = (params = {}) => (
  request.get('/shop/goods/category/all', {params})
)
// 请求商品列表
const fetchItems = (params = {}) => {
  return request.post('/shop/goods/list/v2', params)
}
// 获取商品详情
const fetchItemDetail = (id:number) => request.get('/shop/goods/detail', { params: {id} })

// 用户注册
const userRegister = (params = {}) => {
  return request.post('/user/username/register', params)
}
// 用户登录
const userLogin = (params = {}) => {
  return request.post('/user/username/login', params)
}
export {
  fetchHomeBanner,
  fetchCates,
  fetchItems,
  fetchItemDetail,
  userRegister,
  userLogin
}